import React from "react";
import { MainLayout } from "../components";

const Home = React.lazy(() => import("../views/home"));
const Login = React.lazy(() => import("../views/login"));
const Listmanage = React.lazy(() => import("../views/listManage"));
const ListAdd = React.lazy(() => import("../views/listAdd"));
export interface RouteRawState {
  path: string
  element?: JSX.Element
  meta: {
    title: string
    hidden?: boolean
    roles?:string[] 
  }
  children?:  RouteRawState[]
}


export const Routes_List:RouteRawState[]  = [
  {
    path: "/",
    element: (
      <MainLayout>
        <Home></Home>
      </MainLayout>
    ),
    meta: {
      title: "首页",
    },
  },
  {
    path: "/list",
    meta: {
      title: "列表操作",
      roles: ['admin']
    },
    children: [
      {
        path: "/list/manage",
        element: (
          <MainLayout>
            <Listmanage></Listmanage>
          </MainLayout>
        ),
        meta: {
          title: "列表管理",
        },
      },
      {
        path: "/list/add",
        element: (
          <MainLayout>
            <ListAdd></ListAdd>
          </MainLayout>
        ),
        meta: {
          title: "列表添加"
        },
      },
    ],
  },
  {
    path: "/login",
    element: <Login></Login>,
    meta: {
      title: "登录",
      hidden: true,
    },
  },
];
